part of 'response_model.dart';

///解析对象 {}
ResponseModel<T> _$ResponseModelFromJson<T>(
  Map<String, dynamic>? json,
  T Function(Map<String, dynamic>? json) fromJsonT,
) {
  return ResponseModel<T>(
      json?[ResponseData.data] != null
          ? fromJsonT(json?[ResponseData.data])
          : null,
      json?[ResponseData.errorCode] as int?,
      json?[ResponseData.errorMsg]);
}

///解析list对象 []
ResponseModel<T> _$ResponseListModelFromJson<T>(
  Map<String, dynamic>? json,
  T Function(List<dynamic>? json) fromJsonT,
) {
  return ResponseModel<T>(
    fromJsonT(json?[ResponseData.data]),
    json?[ResponseData.errorCode] as int?,
    json?[ResponseData.errorMsg],
    page:json?["page"] as int?,
    totalPage:json?["totalPage"] as int?,
    total:json?["total"] as int?,
  );
}

Map<String, dynamic> _$ResponseModelToJson<T>(
  ResponseModel<T> instance,
  Object? Function(T? value) toJsonT,
) =>
    <String, dynamic>{
      ResponseData.errorCode: instance.code,
      ResponseData.errorMsg: instance.message,
      ResponseData.data: toJsonT(instance.data),
    };
